const path = require('path');
const webpack = require("webpack");

function resolve(dir) {
    return path.join(__dirname, dir)
}
// 引入等比适配插件

const px2rem = require('postcss-px2rem')

// 配置基本大小
const postcss = px2rem({
    // 基准大小 baseSize，需要和rem.js中相同
    remUnit: 16
})

module.exports = {
    /*   Eslint:false,
     */
    /* baseUrl: './', */
    assetsDir: 'static',
    lintOnSave: false,
    productionSourceMap: false,
    parallel: false,
    publicPath: './',
    configureWebpack: {
        //支持jquery
        plugins: [
            new webpack.ProvidePlugin({
                $: "jquery",
                jQuery: "jquery",
                "windows.jQuery": "jquery"
            })
        ],
    }, // chainWebpack (config) {}
    // 在这个对象下面直接写
    css: {
        loaderOptions: {
            postcss: {
                plugins: [postcss]
            }
        }
    },

    devServer: {
        proxy: {
            '/api': {
                target: 'http://wechat1.cd1a.cn/',
                changeOrigin: true,
                ws: true,
                pathRewrite: {
                    "^/api": ""
                }
            },
            /* '/api': {
            	target: 'https://zhongtai.tiantianchuxing.cn/',
            	changeOrigin: true,
            	ws: true,
            	pathRewrite: { "^/api": "" }
            } */
        },
    },
    // configureWebpack: config => {
    //     Object.assign(config.resolve, {
    //         alias: {
    //             '@': resolve('./src'),
    //             '@api': resolve('./src/api'),
    //             '@view': resolve('./src/view'),
    //             '@utils': resolve('./src/utils'),
    //             '@store': resolve('./src/store')
    //         }
    //     });
    // }
}